package com.rain.cy.business.controller;

import com.rain.cy.business.model.entity.DictionaryEntity;
import com.rain.cy.business.service.DictionaryService;
import com.rain.cy.framework.result.Result;
import com.rain.cy.framework.result.ResultUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yu_chen
 * @since 2021/10/10 16:35
 */
@RestController
@RequestMapping("/api/dic")
public class DictionaryController {


    @Autowired
    private DictionaryService dictionaryService;

    @GetMapping("/data/{type}")
    @ApiOperation(value = "字典数据")
    public Result queryDicList(@PathVariable String type) {
        List<DictionaryEntity> entityList = dictionaryService.lambdaQuery().eq(DictionaryEntity::getCategory, type).list();
        return ResultUtil.success(entityList);
    }

}

